package view
{
	import control.panel.IPanelControl;
	
	import utils.TextTool;
	
	import view.panel.AbsPanel;
	
	public class DebugPanel extends AbsPanel
	{
		private var outText:*;
		private var texts:Array = [];
		
		public function DebugPanel(panelControl:IPanelControl)
		{
			super(panelControl);
			resetBg(600,440);
			initCloseBut();
			resetCloseBut();
			dropShadow();
			
			initText();
		}
		
		private function initText():void
		{
			outText = TextTool.getTextArea(600,400);
			outText.y = 20;
			outText.textField.maxChars = 200;
			outText.maxChars = 200;
			addChild(outText);
		}
		
		public function output(text:String):void
		{
			texts.push("<font size='12' color='#FFFFFF'>" + text + "</font>\n");
			
			if (texts.length > 40)
			{
				texts.shift();
			}
			
			outText.htmlText = texts.toString();
			outText.verticalScrollPosition = outText.maxVerticalScrollPosition;
		}
		
		public function clear():void
		{
			outText.htmlText = "";
			texts.length = 0;
		}
	}
}